<template>
  <div class="allBox">
    <div class="sideBox">
      <el-menu default-active="1-4-1" class="el-menu-vertical-demo" :collapse="false" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
          <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-user"></i>
                <span slot="title">人员管理</span>
              </template>
              <el-menu-item index="1-1" @click="toUserVue">员工管理</el-menu-item>
              <el-menu-item index="1-2">顾客管理</el-menu-item>
          </el-submenu>
          <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-dish"></i>
                <span slot="title">餐品管理</span>
              </template>
              <el-menu-item index="2-1" @click="toCategory()">餐品类别</el-menu-item>
              <el-menu-item index="2-2" @click="toFlavor()">口味管理</el-menu-item>
              <el-menu-item index="2-3" @click="toDish()">菜品管理</el-menu-item>
              <el-menu-item index="2-4" @click="toMeal()">套餐管理</el-menu-item>
          </el-submenu>
          <el-menu-item index="3">
              <i class="el-icon-document"></i>
              <span slot="title" @click="toOrder()">订单管理</span>
          </el-menu-item>
          <el-menu-item index="4">
            <i class="el-icon-document"></i>
            <span slot="title" @click="toRoom()">餐位管理</span>
        </el-menu-item>
          <el-menu-item index="5">
            <i class="el-icon-s-data"></i>
            <span slot="title" @click="toDataCount()">数据统计</span>
          </el-menu-item>
          <!-- <el-menu-item index="4">
              <i class="el-icon-setting"></i>
              <span slot="title">系统设置</span>
          </el-menu-item> -->
          <el-submenu index="6">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span slot="title">系统设置</span>
            </template>
            <el-menu-item index="6-1" @click="toCarousel()">轮播图管理</el-menu-item>
          </el-submenu>
      </el-menu>
    </div>
    <div class="viewBox">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
import router from '@/router';
export default {
    data() {
      return {
        //是否展开
        isCollapse: true,
        //权限判断，0是管理员，1是普通用户
        Root:{},
      };
    },

    methods: {
      toRoom(){
        router.push("/room")
      },
      toUserVue(){
        router.push("/user");
      },
      toCategory(){
        router.push("/category")
      },
      toFlavor(){
        router.push("/flavor")
      },
      toDish(){
        router.push("/dish")
      },
      toMeal(){
        router.push("/meal")
      },
      toCarousel(){
        router.push("/carousel")
      },
      toOrder(){
        router.push("/order")
      },
      toDataCount(){
        router.push("/dataCount")
      }
    },

    mounted() {
      //页面加载时就从本地通过localstorage获取存储的token值
      this.token =  localStorage.getItem('token')
    },

  }
</script>

<style>
@import '../assets/css/side.css';
</style>